<template>
  <div class="dashboard-editor-container">
    <el-tabs type="border-card" @tab-click="handleTabClick" v-model="activeTab">
      <el-tab-pane label="资产信息" name="tab1" lazy>
        <assetsInfo :Moder="Moder"></assetsInfo>
      </el-tab-pane>
      <el-tab-pane label="硬件详情" lazy>
        <HardDetail :DeviceObj=deviceForm></HardDetail>
      </el-tab-pane>
      <!-- <el-tab-pane label="历史IP信息">
        <historicalIp ref="历史IP信息"></historicalIp>
      </el-tab-pane> -->
      <el-tab-pane label="今日事件" lazy>
        <div class="top">
          <el-button type="primary" style="float:right;margin-bottom: 10px;" @click="$router.go(-1)">返回</el-button>
        </div>
        <el-table stripe border :data="eventTable" style="width: 100%; margin-top: 15px;min-height:520px">
          <el-table-column label="序号" width="60" type="index"
            :index='(index) => { return (index + 1) + (this.EventpageNum - 1) * this.EventpageSize }'> </el-table-column>
          <el-table-column label="部门" show-overflow-tooltip prop="Department" width="120px"></el-table-column>
          <el-table-column label="资产名称" show-overflow-tooltip prop="DeviceName" width="160px"></el-table-column>
          <el-table-column label="使用者" show-overflow-tooltip prop="UserName" width="120px"></el-table-column>
          <el-table-column label="发生时间" show-overflow-tooltip prop="TransTime" width="160px"></el-table-column>
          <el-table-column label="严重性等级" show-overflow-tooltip prop="EventLevel" width="100">
            <template slot-scope="{row}">
              <span style="color:#F56C6C" v-show="row.EventLevel == '1'">紧急</span>
              <span style="color:#E6A23C" v-show="row.EventLevel == '2'">重要</span>
              <span style="color:#909399" v-show="row.EventLevel == '3'">默认</span>
              <span style="color:#409EFF" v-show="row.EventLevel == '4'">普通</span>
              <span style="color:#67C23A" v-show="row.EventLevel == '5'">告知</span>
            </template>
          </el-table-column>
          <el-table-column label="描述信息" show-overflow-tooltip prop="Descp"></el-table-column>
          <el-table-column label="确认状态" show-overflow-tooltip prop="IsAck" width="100">
            <template slot-scope="{row}">
              <span style="color:#909399" v-show="row.IsACK == '0'">未确认</span>
              <span style="color:#67C23A" v-show="row.IsACK == '1'">已确认</span>
            </template>
          </el-table-column>
          <el-table-column label="操作" width="120px" fixed="right">
            <template slot="header" slot-scope="scope">
              <el-button size="mini" :type="!control ? 'info' : 'primary'" :disabled="!control"
                @click="changeMailGlobalAll(scope.row)">确认本页</el-button>
            </template>
            <template slot-scope="scope">
              <el-button size="mini" :type="scope.row.IsACK ? 'info' : 'primary'" :disabled="scope.row.IsACK != 0"
                @click="changeMailGlobal(scope.row)">确 认</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination @size-change="handleSizeChangeEvent" @current-change="handleCurrentChangeEvent"
          :current-page=EventpageNum :page-size=EventpageSize background layout="total, prev, pager, sizes, next, jumper"
          :total="EventTotal">
        </el-pagination>
      </el-tab-pane>
      <el-tab-pane label="CPU监测" lazy>
        <div class="top">
          <el-button type="primary" style="position: absolute; right: 15px; top: 15px;"
            @click="$router.go(-1)">返回</el-button>
        </div>
        <div style="margin-top:30px;">
          <linechart :chartData="lineData_cpu"></linechart>
        </div>
      </el-tab-pane>
      <el-tab-pane label="内存监测" lazy>
        <div class="top">
          <el-button type="primary" style="position: absolute; right: 15px; top: 15px;"
            @click="$router.go(-1)">返回</el-button>
        </div>
        <div style="margin-top:30px;">
          <linechart :chartData="lineData_soft"></linechart>
        </div>
      </el-tab-pane>
      <el-tab-pane label="网络业务">
        <div class="top">
          <el-button type="primary" style="float:right;margin-bottom: 10px;" @click="$router.go(-1)">返回</el-button>
        </div>
        <el-table stripe border :data="netForm" style="width: 100%; margin-top: 15px;min-height:520px">
          <el-table-column label="序号" width="60" type="index"
            :index='(index) => { return (index + 1) + (this.pageNum_net - 1) * this.pageSize_net }'> </el-table-column>
          <el-table-column label="部门" show-overflow-tooltip prop="Department" width="120"></el-table-column>
          <el-table-column label="资产名称" show-overflow-tooltip prop="DeviceName">
            <template slot-scope="{row}">
              <span>{{ row.DeviceName }}</span>
            </template>
          </el-table-column>
          <el-table-column label="检测时间" show-overflow-tooltip prop="TransTime"></el-table-column>
          <el-table-column label="网络业务" show-overflow-tooltip prop="ServiceName"></el-table-column>
          <el-table-column label="检测结果" show-overflow-tooltip prop="Status">
            <template slot-scope="{row}">
              <span :style="{ color: row.Status === 1 ? '#67C23A' : '#F56C6C' }">{{ row.Status === 1 ? '正常' : '异常'
              }}</span>
            </template>
          </el-table-column>
          <el-table-column label="检测描述" show-overflow-tooltip prop="Descp"></el-table-column>
          <el-table-column label="操作" width="120px" fixed="right">
            <template slot-scope="scope">
              <el-button size="mini" type="primary" @click="changeMailGlobalnet(scope.row)">最近日志</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination @size-change="handleSizeChangeNet" @current-change="handleCurrentChangeNet"
          :current-page=pageNum_net :page-size=pageSize_net background layout="total, prev, pager, sizes, next, jumper"
          :total="total_net">
        </el-pagination>
      </el-tab-pane>
      <!-- <el-tab-pane label="进程管理" lazy>
        <processManagement ref="进程管理"></processManagement>
      </el-tab-pane> -->
      <!-- <el-tab-pane label="端口管理">
        <portManagement ref="端口管理"></portManagement>
      </el-tab-pane> -->
      <!-- <el-tab-pane label="服务管理" lazy>
        <serviceManagement ref="服务管理"></serviceManagement>
      </el-tab-pane> -->
      <el-tab-pane label="软件使用" lazy>
        <div class="top">
          <el-button type="primary" style="float:right;margin-bottom: 10px;" @click="$router.go(-1)">返回</el-button>
        </div>
        <el-table stripe border :data="useSoftTable" style="width: 100%; margin-top: 15px;min-height:520px">
          <el-table-column label="序号" width="60" type="index"
            :index='(index) => { return (index + 1) + (this.useSoftpageNum - 1) * this.useSoftpageSize }'>
          </el-table-column>
          <el-table-column label="部门" show-overflow-tooltip prop="Department" width="120"></el-table-column>
          <el-table-column label="资产名称" show-overflow-tooltip prop="DeviceName" width="180"></el-table-column>
          <el-table-column label="统计时间" show-overflow-tooltip prop="TransTime" width="160px">
            <template slot-scope="{row}">
              <span>{{ parseTime(row.TransTime) }}</span>
            </template>
          </el-table-column>
          <el-table-column label="使用时长" show-overflow-tooltip prop="RunningSeconds"></el-table-column>
          <el-table-column label="软件分类" show-overflow-tooltip prop="Class">
            <template slot-scope="{row}">
              <span>{{ row.Class === '' ? '未分类' : row.Class }}</span>
            </template>
          </el-table-column>
          <el-table-column label="软件名称" show-overflow-tooltip prop="ProcName"></el-table-column>
          <el-table-column label="执行文件" show-overflow-tooltip prop="ProcExe"></el-table-column>
          <el-table-column label="窗口标题" show-overflow-tooltip prop="Title"></el-table-column>
          <el-table-column label="执行文件全路径" show-overflow-tooltip prop="FullPath"></el-table-column>
          <el-table-column label="签名厂商" show-overflow-tooltip prop="CertFactory"></el-table-column>
          <!-- <el-table-column label="操作" width="120px" fixed="right">
            <template slot-scope="scope">
              <el-button :type="scope.row.ProcClass == '' || scope.row.ProcClass == '未分类' ? 'primary' : 'info'"
                :disabled="scope.row.ProcClass != ''" size="mini" @click="changeModer_use(scope.row)">加入字典</el-button>
            </template>
          </el-table-column> -->
        </el-table>
        <el-pagination @size-change="handleSizeChangeuse" @current-change="handleCurrentChangeuse"
          :current-page=useSoftpageNum :page-size=useSoftpageSize background
          layout="total, prev, pager, sizes, next, jumper" :total="useSoftTotal">
        </el-pagination>
      </el-tab-pane>
      <el-tab-pane label="安装软件" lazy>
        <div class="top">
          <el-button type="primary" style="float:right;margin-bottom: 10px;" @click="$router.go(-1)">返回</el-button>
        </div>
        <el-table stripe border :data="installTable" style="width: 100%; margin-top: 15px;min-height:520px">
          <el-table-column label="序号" width="60" type="index"
            :index='(index) => { return (index + 1) + (this.pageNum_int - 1) * this.pageSize_int }'> </el-table-column>
          <el-table-column label="部门" show-overflow-tooltip prop="Department" width="120"></el-table-column>
          <el-table-column label="资产名称" show-overflow-tooltip prop="DeviceName" width="180"></el-table-column>
          <el-table-column label="采集时间" show-overflow-tooltip prop="TransTime"></el-table-column>
          <el-table-column label="软件分类" show-overflow-tooltip prop="AppClass">
            <template slot-scope="{row}">
              <span>{{ row.AppClass === '' ? '未分类' : row.AppClass }}</span>
            </template>
          </el-table-column>
          <el-table-column label="软件名称" show-overflow-tooltip prop="AppName"></el-table-column>
          <el-table-column label="操作系统" show-overflow-tooltip prop="OSClass"></el-table-column>
          <el-table-column label="发布厂商" show-overflow-tooltip prop="Descp"></el-table-column>
          <el-table-column label="版本号 " show-overflow-tooltip prop="Version"></el-table-column>
          <!-- <el-table-column label="操作" width="120px" fixed="right">
            <template slot-scope="scope">
              <el-button :type="scope.row.AppClass == '' || scope.row.AppClass == '未分类' ? 'primary' : 'info'"
                :disabled="scope.row.AppClass != ''" size="mini" @click="changeModer_int(scope.row)">加入字典</el-button>
            </template>
          </el-table-column> -->
        </el-table>
        <el-pagination @size-change="handleSizeChange_int" @current-change="handleCurrentChange_int"
          :current-page=pageNum_int :page-size=pageSize_int background layout="total, prev, pager, sizes, next, jumper"
          :total="Total_int">
        </el-pagination>
      </el-tab-pane>
      <el-tab-pane label="非法软件" lazy>
        <div class="top">
          <el-button type="primary" style="float:right;margin-bottom: 10px;" @click="$router.go(-1)">返回</el-button>
        </div>
        <el-table stripe border :data="illegalityTable" style="width: 100%; margin-top: 15px;min-height:520px">
          <el-table-column label="序号" width="60" type="index"
            :index='(index) => { return (index + 1) + (this.pageNum_ill - 1) * this.pageSize_ill }'> </el-table-column>
          <el-table-column label="部门" show-overflow-tooltip prop="Department" width="120"></el-table-column>
          <el-table-column label="资产名称" show-overflow-tooltip prop="DeviceName" width="180"></el-table-column>
          <el-table-column label="采集时间" show-overflow-tooltip prop="TransTime"></el-table-column>
          <el-table-column label="软件分类" show-overflow-tooltip prop="AppClass">
            <template slot-scope="{row}">
              <span>{{ row.AppClass === '' ? '未分类' : row.AppClass }}</span>
            </template>
          </el-table-column>
          <el-table-column label="软件名称" show-overflow-tooltip prop="AppName"></el-table-column>
          <el-table-column label="操作系统" show-overflow-tooltip prop="OSClass"></el-table-column>
          <el-table-column label="发布厂商" show-overflow-tooltip prop="Descp"></el-table-column>
          <el-table-column label="版本号 " show-overflow-tooltip prop="Version"></el-table-column>
          <!-- <el-table-column label="操作" width="120px"  fixed="right" >
                <template slot-scope="scope">
                  <el-button type="primary" size="mini" @click="changeModer_int(scope.row)">加入字典</el-button>
                </template>
              </el-table-column> -->
        </el-table>
        <el-pagination @size-change="handleSizeChange_ill" @current-change="handleCurrentChange_ill"
          :current-page=pageNum_ill :page-size=pageSize_ill background layout="total, prev, pager, sizes, next, jumper"
          :total="Total_ill">
        </el-pagination>
      </el-tab-pane>
      <el-tab-pane label="缺失软件" lazy>
        <div class="top">
          <el-button type="primary" style="float:right;margin-bottom: 10px;" @click="$router.go(-1)">返回</el-button>
        </div>
        <el-table stripe border :data="deficiencyTable" style="width: 100%; margin-top: 15px;min-height:520px">
          <el-table-column label="序号" width="60" type="index"
            :index='(index) => { return (index + 1) + (this.pageNum_def - 1) * this.pageSize_def }'> </el-table-column>
          <el-table-column label="部门" show-overflow-tooltip prop="Department" width="120"></el-table-column>
          <el-table-column label="资产名称" show-overflow-tooltip prop="DeviceName" width="180"></el-table-column>
          <!-- <el-table-column label="采集时间" show-overflow-tooltip prop="TransTime" ></el-table-column> -->
          <el-table-column label="软件分类" show-overflow-tooltip prop="AppClass">
            <template slot-scope="{row}">
              <span>{{ row.AppClass === '' ? '未分类' : row.AppClass }}</span>
            </template>
          </el-table-column>
          <el-table-column label="软件名称" show-overflow-tooltip prop="AppName"></el-table-column>
          <!-- <el-table-column label="操作系统" show-overflow-tooltip prop="OSClass"></el-table-column> -->
          <!-- <el-table-column label="发布厂商" show-overflow-tooltip prop="Descp" ></el-table-column> -->
          <!-- <el-table-column label="版本号 " show-overflow-tooltip prop="Version"></el-table-column> -->
          <!-- <el-table-column label="操作" width="120px"  fixed="right" >
              <template slot-scope="scope">
                <el-button type="primary" size="mini" @click="changeModer_int(scope.row)">加入字典</el-button>
              </template>
            </el-table-column> -->
        </el-table>
        <el-pagination @size-change="handleSizeChange_def" @current-change="handleCurrentChange_def"
          :current-page=pageNum_def :page-size=pageSize_def background layout="total, prev, pager, sizes, next, jumper"
          :total="Total_def">
        </el-pagination>
      </el-tab-pane>
      <el-tab-pane label="状态变更" lazy>
        <div class="top">
          <el-button type="primary" style="float:right;margin-bottom: 10px;" @click="$router.go(-1)">返回</el-button>
        </div>
        <el-table stripe border :data="devieceStaTable" style="width: 100%; margin-top: 15px;min-height:520px">
          <el-table-column label="序号" width="60" type="index"
            :index='(index) => { return (index + 1) + (this.pageNum_dev - 1) * this.pageSize_dev }'> </el-table-column>
          <el-table-column label="部门" show-overflow-tooltip prop="Department" width="120"></el-table-column>
          <el-table-column label="资产名称" prop="DeviceName" width="140" show-overflow-tooltip></el-table-column>
          <el-table-column label="发生时间" prop="TransTime" width="160"></el-table-column>
          <el-table-column label="状态变化" prop="Status" width="140">
            <template slot-scope="{row}">
              <span style="color:#909399" v-show="row.Status == 2">下线</span>
              <span style="color:#67C23A" v-show="row.Status == 1">上线</span>
            </template>
          </el-table-column>
          <el-table-column label="变更原因" prop="Reason"></el-table-column>
        </el-table>
        <el-pagination @size-change="handleSizeChange_dev" @current-change="handleCurrentChange_dev"
          :current-page=pageNum_dev :page-size=pageSize_dev background layout="total, prev, pager, sizes, next, jumper"
          :total="Total_dev">
        </el-pagination>
      </el-tab-pane>
      <el-tab-pane label="基线核查" lazy>
        <div class="top" style="float:right;margin-bottom: 10px;">
          <el-button type="primary" @click="exportFollow">导出</el-button>
          <el-button type="primary" @click="$router.go(-1)">返回</el-button>
        </div>
        <el-table stripe border :data="BaseLineForm" style="width: 100%; margin-top: 15px;min-height:520px">
          <el-table-column label="序号" width="60" type="index"
            :index='(index) => { return (index + 1) + (this.pageNum_event - 1) * this.pageSize_event }'>
          </el-table-column>
          <el-table-column label="部门" show-overflow-tooltip prop="Department" width="120"></el-table-column>
          <el-table-column label="资产名称" show-overflow-tooltip prop="DeviceName" width="180">
            <template slot-scope="{row}">
              <span>{{ row.DeviceName }}</span>
            </template>
          </el-table-column>
          <el-table-column label="检测时间" show-overflow-tooltip prop="TransTime" width="160"></el-table-column>
          <el-table-column label="核查项目" show-overflow-tooltip prop="BlID">
            <template slot-scope="{row}">
              <span>{{ findBaselineLabel(row.BlID) }}</span>
            </template>
          </el-table-column>
          <el-table-column label="合规结论" show-overflow-tooltip prop="NeedFix" width="120">
            <template slot-scope="{row}">
              <span :style="{ color: row.NeedFix === 0 ? '#67C23A' : '#F56C6C' }">{{ row.NeedFix === 0 ? '合规' :
                '不合规' }}</span>
            </template>
          </el-table-column>
          <el-table-column label="描述信息" show-overflow-tooltip prop="Descp"></el-table-column>
          <el-table-column label="操作" width="120px" fixed="right">
            <template slot-scope="scope">
              <el-button size="mini" type="primary" @click="changeMailGlobalBase(scope.row)">详情</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination @size-change="handleSizeChange_event" @current-change="handleCurrentChange_event"
          :current-page=pageNum_event :page-size=pageSize_event background
          layout="total, prev, pager, sizes, next, jumper" :total="Total_event">
        </el-pagination>
      </el-tab-pane>
      <el-tab-pane label="最近屏幕" lazy>
        <recentlyTheScreen ref="最近屏幕"></recentlyTheScreen>
      </el-tab-pane>
      <el-tab-pane label="工作流水" lazy>
        <detailWorkFlow ref="工作流水"></detailWorkFlow>
      </el-tab-pane>
      <el-tab-pane label="工作绩效" lazy>
        <detailJob ref="工作绩效"></detailJob>
      </el-tab-pane>
      <el-tab-pane label="域名统计" lazy>
        <detailDomainName ref="域名统计"></detailDomainName>
      </el-tab-pane>
      <el-tab-pane label="软件外联" lazy>
        <detailsSoftware ref="软件外联"></detailsSoftware>
      </el-tab-pane>
      <el-tab-pane label="进程加载" lazy>
        <detailProcess ref="进程加载"></detailProcess>
      </el-tab-pane>
      <el-tab-pane label="共享目录" lazy>
        <detailShare ref="共享目录"></detailShare>
      </el-tab-pane>
      <el-tab-pane label="开机自启" lazy>
        <detailPowerBoot ref="开机自启"></detailPowerBoot>
      </el-tab-pane>
      <el-tab-pane label="开放端口" lazy>
        <detailOpenPort ref="开放端口"></detailOpenPort>
      </el-tab-pane>
    </el-tabs>
    <el-dialog top="5vh" :close-on-click-modal="false" :close-on-press-escape=false title="最近日志"
      :visible.sync="logDialognet" v-el-drag-dialog width="80%">
      <el-table stripe border :data="logList" style="width: 100%;" height="490px">
        <el-table-column label="序号" width="60" type="index"
          :index='(index) => { return (index + 1) + (this.pageNum2 - 1) * this.pageSize2 }'> </el-table-column>
        <el-table-column label="资产名称" prop="DeviceName" width="180" show-overflow-tooltip></el-table-column>
        <el-table-column label="检测时间" prop="TransTime" show-overflow-tooltip width="160"></el-table-column>
        <el-table-column label="网络业务" prop="ServiceName" show-overflow-tooltip width="240"></el-table-column>
        <el-table-column label="检测结果" prop="Status" show-overflow-tooltip width="120">
          <template slot-scope="{row}">
            <span :style="{ color: row.Status === 1 ? '#67C23A' : '#F56C6C' }">{{ row.Status === 1 ? '正常' : '异常' }}</span>
          </template>
        </el-table-column>
        <el-table-column label="检测描述" prop="Descp" show-overflow-tooltip></el-table-column>
      </el-table>
      <el-pagination @size-change="handleSizeChange2" @current-change="handleCurrentChange2" :current-page=pageNum2
        :page-size=pageSize2 background layout="total, prev, pager, sizes, next, jumper" :total="total2">
      </el-pagination>
      <span slot="footer" class="dialog-footer">
        <el-button type="info" @click="logDialognet = false">关 闭</el-button>
      </span>
    </el-dialog>
    <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="moderVisible" title="加入字典"
      v-el-drag-dialog @close="ModerDict = {}" width="30%">
      <el-form label-width="100px" :rules="rules" :model="ModerDict" ref="ModerDict">
        <el-form-item label="软件名称" prop="AppName">
          <el-input placeholder="请输入软件名称" maxlength="16" v-model="ModerDict.AppName"></el-input>
        </el-form-item>
        <el-form-item label="软件分类" prop="Class">
          <el-select v-model="ModerDict.Class" placeholder="请选择软件分类" style="width:100%">
            <el-option v-for="(item, index) in partitionList_soft" :key="index" :label="item.label"
              :value="item.value"></el-option>
          </el-select>
        </el-form-item>
        <!-- <el-form-item label="软件安装名" prop="ExeName">
          <el-input placeholder="请输入软件安装名" oninput="value=value.replace(/[^0-9a-zA-Z.]/g,'')" maxlength="32" v-model="ModerDict.ExeName"></el-input>
        </el-form-item> -->
        <el-form-item label="软件版本" prop="Version">
          <el-input placeholder="请输入软件版本" maxlength="32" v-model="ModerDict.Version"></el-input>
        </el-form-item>
        <el-form-item label="操作系统" prop="OSClass">
          <el-select v-model="ModerDict.OSClass" style="width:100%" placeholder="请选择适用系统">
            <el-option label="Windows" value="Windows"></el-option>
            <el-option label="Mac" value="Mac"></el-option>
            <el-option label="Android" value="Android"></el-option>
            <el-option label="Linux" value="Linux"></el-option>
            <el-option label="Other" value="Other"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="系统类型" prop="OSType">
          <el-select v-model="ModerDict.OSType" style="width:100%" placeholder="请选择系统类型">
            <el-option label="全部" value=""></el-option>
            <el-option label="64" value="64"></el-option>
            <el-option label="32" value="32"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="软件类型" prop="Property">
          <el-select v-model="ModerDict.Property" style="width:100%" placeholder="请选择软件类型">
            <el-option label="必装软件" :value="1"></el-option>
            <el-option label="非法软件" :value="2"></el-option>
            <el-option label="选装软件" :value="3"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submit_soft()">确 定</el-button>
        <el-button type="info" @click="moderVisible = false">取 消</el-button>
      </span>
    </el-dialog>
    <el-dialog :close-on-click-modal="false" :close-on-press-escape=false title="详情" :visible.sync="BashLineShow"
      v-el-drag-dialog width="1000px">
      <el-descriptions class="margin-top" :column="2" border>
        <el-descriptions-item label="从属部门">{{ BaseLineinfo.Department }}</el-descriptions-item>
        <el-descriptions-item label="资产名称">{{ BaseLineinfo.DeviceName }}</el-descriptions-item>
        <el-descriptions-item label="资产唯一编码">{{ BaseLineinfo.DeviceUUID }}</el-descriptions-item>
        <el-descriptions-item label="检测时间">{{ BaseLineinfo.TransTime }}</el-descriptions-item>
        <el-descriptions-item label="核查项目">
          <span>{{ findBaselineLabel(BaseLineinfo.BlID) }}</span>
        </el-descriptions-item>
        <el-descriptions-item label="合规结论">
          <span :style="{ color: BaseLineinfo.NeedFix === 0 ? '#67C23A' : '#F56C6C' }">{{ BaseLineinfo.NeedFix === 0 ?
            '合规' :
            '不合规' }}</span>
        </el-descriptions-item>
        <el-descriptions-item label="描述信息" :span="2">{{ BaseLineinfo.Descp }}</el-descriptions-item>
        <el-descriptions-item label="修复建议" :span="2">{{ findBaselineFixScheme(BaseLineinfo.BlID) }}</el-descriptions-item>
      </el-descriptions>
      <span slot="footer" class="dialog-footer">
        <el-button type="info" @click="BashLineShow = false">关 闭</el-button>
      </span>
    </el-dialog>
    <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="UsemoderVisible" title="加入字典"
      v-el-drag-dialog @close="ModerDict = {}, $refs['ModerDict_use'].resetFields();" width="30%">
      <el-form label-width="100px" :rules="rules2" :model="ModerDict" ref="ModerDict_use">
        <el-form-item label="执行文件" prop="ProcExe">
          <el-input placeholder="请输入执行文件" disabled v-model="ModerDict.ProcExe"></el-input>
        </el-form-item>
        <el-form-item label="进程分类" prop="ProcClass">
          <el-select v-model="ModerDict.ProcClass" placeholder="请选择进程分类" style="width:100%">
            <el-option v-for="(item, index) in partitionList_use" :key="index" :label="item.label"
              :value="item.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="进程名称" prop="ProcName">
          <el-input placeholder="请输入进程名称" maxlength="16" v-model.trim="ModerDict.ProcName"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submit_use()">确 定</el-button>
        <el-button type="info" @click="UsemoderVisible = false, $refs['ModerDict_use'].resetFields();">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import XLSX from 'xlsx'
import assetsInfo from "@/components/assetsInfo"
import portManagement from '@/views/asset/portManagement'
import processManagement from '@/views/asset/processManagement'
import serviceManagement from '@/views/asset/serviceManagement'
import historicalIp from '@/views/realTimeTraffic/historicalIp'
import strategyInformation from '@/views/realTimeTraffic/strategyInformation'
import recentlyTheScreen from '@/views/realTimeTraffic/recentlyTheScreen'
import detailWorkFlow from '@/views/realTimeTraffic/detailWorkFlow'
import detailProcess from '@/views/realTimeTraffic/detailProcess'
import detailShare from '@/views/realTimeTraffic/detailShare'
import detailPowerBoot from '@/views/realTimeTraffic/detailPowerBoot'
import detailOpenPort from '@/views/realTimeTraffic/detailOpenPort'
import detailsSoftware from '@/views/realTimeTraffic/detailsSoftware'
import detailJob from '@/views/realTimeTraffic/detailJob'
import detailDomainName from '@/views/realTimeTraffic/detailDomainName'
import HardDetail from "@/components/HardDetail"
import linechart from "./components/linechart.vue"
import elDragDialog from "@/directive/el-drag-dialog";
import { connrequest } from '@/api/firstPage'
import { parseTime, formatDuration, getNowDay, bytesToSize, formatTime2 } from '@/utils/index'
export default {
  directives: { elDragDialog },
  components: {
    assetsInfo,
    linechart,
    HardDetail,
    portManagement,
    processManagement,
    serviceManagement,
    historicalIp,
    detailShare,
    recentlyTheScreen,
    strategyInformation,
    detailWorkFlow,
    detailProcess,
    detailShare,
    detailPowerBoot,
    detailOpenPort,
    detailsSoftware,
    detailJob,
    detailDomainName
  },
  data() {
    let that = this
    return {
      control: false,
      ModerDict: {},
      Moder: {},
      partitionList: [],
      partitionList_use: [],
      partitionList_soft: [],
      activeTab: 'tab1',
      UsemoderVisible: false,
      moderVisible: false,
      deviceForm: {},
      rules: [], // elementui组件属性
      installTable: [],
      pageNum_int: 1,
      pageSize_int: 10,
      Total_int: 0,
      illegalityTable: [],
      pageNum_ill: 1,
      pageSize_ill: 10,
      Total_ill: 0,
      deficiencyTable: [],
      pageNum_def: 1,
      pageSize_def: 10,
      Total_def: 0,
      devieceStaTable: [],
      pageNum_dev: 1,
      pageSize_dev: 10,
      Total_dev: 0,
      eventTable: [],
      pageNum_event: 1,
      pageSize_event: 10,
      Total_event: 0,
      netForm: [],
      EventpageNum: 1,
      EventpageSize: 10,
      EventTotal: 0,
      useSoftTable: [],
      useSoftpageNum: 1,
      useSoftpageSize: 10,
      useSoftTotal: 0,
      BaseLineForm: [],
      BaseLineinfo: [],
      BashLineShow: false,
      BaselineResultList: [],
      total: 0,
      eventList: [],
      lineData_cpu: {
        time: [], downByte: [], info: ''
      },
      lineData_soft: {
        time: [], downByte: [], info: ''
      },
      SystemData: [],
      logDialognet: false,
      logList: [],
      pageNum: 1,
      pageSize: 10,
      pageNum_net: 1,
      pageSize_net: 10,
      total_net: 0,
      pageNum2: 1,
      pageSize2: 10,
      total2: 0,
      pageNum_app: 1,
      pageSize_app: 10,
      Device_pageNum: 1,
      Device_pageSize: 10,
      total: 0,
      formOptions: [
        {
          col: 4,
          hidden: false,
          label: "在线状态", // label文字
          prop: "Status", // 字段名
          element: "el-select", // 指定elementui组件
          initValue: 0, // 字段初始值,
          placeholder: "请选择在线状态", // elementui组件属性
          options: [
            { label: '全部', value: 0 },
            { label: '在线', value: 1 },
            { label: '离线', value: 2 }
          ],
          rules: [], // elementui组件属性
          events: {
            input(val) {
              that.searchform.Status = val
            }
          }
        },
        {
          col: 4,
          hidden: false,
          label: "排序字段", // label文字
          prop: "Sort_value", // 字段名
          element: "el-select", // 指定elementui组件
          initValue: "SchoolName", // 字段初始值,
          placeholder: "请选择排序字段", // elementui组件属性
          options: [
            { label: '校区名称', value: 'SchoolName' },
            { label: '在线状态', value: 'Status' },
            { label: '运行时长', value: 'KeepRunningTime' }
          ],
          events: {
            input(val) {
              that.searchform.Sort_value = val
            }
          }
        }

      ],
      rules: {
        SchoolID: [
          { required: true, message: '请选择校区编码', trigger: 'blur' }
        ],
        SchoolName: [
          { required: true, message: '请选择校区名称', trigger: 'blur' }
        ],
        PrimArea: [
          { required: true, message: '请选择上级分区', trigger: 'change' }
        ],
        SecondArea: [
          { required: true, message: '请输入分区名称', trigger: 'blur' }
        ],
        AreaCode: [
          { required: true, message: '请输入分区编码', trigger: 'blur' }
        ],
        ClassName: [
          { required: true, message: '请输入教室', trigger: 'blur' }
        ],
        Phone: [
          { required: true, message: '请输入联系电话', trigger: 'blur' },
          {
            validator: function (rule, value, callback) {
              if (/^1[34578]\d{9}$/.test(value) == false && value) {
                callback(new Error("手机号格式错误"));
              } else {
                callback();
              }
            },
            trigger: "blur"
          }
        ],
        DeviceClass: [
          { required: true, message: '请选择操作系统', trigger: 'change' }
        ],
        DeviceType: [
          { required: true, message: '请选择资产类型', trigger: 'change' }
        ]
      },
      rules2: {
        ProcExe: [
          { required: true, message: '请输入执行文件', trigger: 'blur' }
        ],
        ProcClass: [
          { required: true, message: '请选择进程分类', trigger: 'blur' }
        ],
        ProcName: [
          { required: true, message: '请输入进程名称', trigger: 'blur' }
        ]
      },
      netInfo: {},
    }
  },
  mounted() {
    this.Moder = JSON.parse(sessionStorage.getItem('detailStatus'))
    // this.Moder = this.$route.query.Moder
    this.getSystemData()
    this.GetDictSoftwareTree()
    this.GetDictUseSoftTree()
  },
  methods: {
    parseTime,
    async getSystemData() {
      const res = await connrequest('GetParamThreshhold')
      res.Data = res.Data || []
      res.Data.map(item => {
        this.SystemData[item.Name] = item.Value
      })
      this.SystemData.cach_log_save_seconds = this.SystemData.cach_log_save_seconds / 3600 || 0
    },
    handleTabClick(tab) {
      const methodName = this.getMethodNameByTabIndex(tab.index);
      const method = this[methodName];
      if (method) {
        console.log(this.Moder);
        method(this.Moder);
      }
    },
    // 根据 tab.index 获取方法名
    getMethodNameByTabIndex(tabIndex) {
      const methodNames = [
        'getDeviceData',
        // 'getNotInfo',
        'getEvent',
        'changeModer',
        'changeModer_soft',
        // 'getNotInfo',
        'getNetData',
        // 'getNotInfo',
        // 'getNotInfo',
        // 'getNotInfo',
        'getuseSoft',
        'getinstallData',
        'getillegalityData',
        'getdeficiencyData',
        'getDeviceStatus',
        'getBaseLineData',
        'getNotInfo',
      ];  //我丢，这是什么烂语法，维护困难，灵活性又差，这里的方法顺序需要与tab顺序相同，否则方法对应不上会出现问题，上面删除了，这里对应的方法也得删除
      return methodNames[tabIndex - 1] || ''; // 注意减去1以匹配数组索引
    },
    async changeMailGlobalBase(row) {
      this.BaseLineinfo = { ...row }
      this.BashLineShow = true
    },
    getNotInfo() { },
    // 获取事件定义
    async GetParamDictEvent() {
      const data = {
        Paging: {
          QueryPageNo: 1,
          QueryPageLength: 100000000
        }
      }
      const res = await connrequest('GetParamDictEvent', data)
      let arr = []
      res.Data.map(item => {
        arr.push({ label: item.AlarmDescp, value: item.EventID })
      })
      this.formOptions.map(item => {
        if (item.label === '事件类型') {
          item.options = arr
          item.initValue = arr[0]?.value
        }
      })
      this.eventList = arr
    },
    getEventLabel(eventID) {
      return this.eventList.find(item => item.value === eventID)?.label || null;
    },
    async changeMailGlobalnet(row) {
      this.netInfo = { ...row }
      const data = {
        Paging: {
          QueryPageNo: this.pageNum2,
          QueryPageLength: this.pageSize2
        },
        Filter: {
          DeviceUUID: row.DeviceUUID,
          NetworkServiceName: row.ServiceName
        }
      }
      const res = await connrequest('GetDeviceHistoryNetworkService', data)
      res.Data = res.Data.map(item => {
        item.TransTime = formatTime2(item.TransTime)
        return item
      })
      this.logList = res.Data
      this.total2 = res.Paging?.TotalCount
      this.logDialognet = true
    },
    async submit_use() {
      this.$refs['ModerDict_use'].validate(async (valid) => {
        if (valid) {
          const data = {
            Data: {
              Action: 1,
              Detail: {
                ExeName: this.ModerDict.ProcExe,
                Class: this.ModerDict.ProcClass,
                Name: this.ModerDict.ProcName
              }
            }
          }
          const res = await connrequest('EditDictProc', data)
          if (res.Status.StatusCode === 0) {
            this.$message.success('加入字典成功')
            // this.getuseSoft(this.Moder)
            this.UsemoderVisible = false
          }
        }
      })
    },
    async submit_soft() {
      const data = {
        Data: {
          Action: 1,
          Detail: {
            Descp: this.ModerDict.AppName,
            Factory: this.ModerDict.Descp,
            Class: this.ModerDict.Class,
            Version: this.ModerDict.Version,
            OSClass: this.ModerDict.OSClass,
            OSType: this.ModerDict.OSType,
            Property: this.ModerDict.Property,
          }
        }
      }
      const res = await connrequest('EditDictInstallApp', data)
      if (res.Status.StatusCode === 0) {
        this.$message.success('加入字典成功')
        // this.getinstallData(this.Moder)
        this.moderVisible = false
      }
    },
    async GetBaselineFixSet() {
      const res = await connrequest('GetBaselineFixSet')
      let arr = res.Data.flatMap(item => item.SubClass || [])
      this.formOptions.map(item => {
        if (item.label === '检测项目') {
          item.options = [{ label: '全部', value: '', FixScheme: '' }, ...arr]
        }
      })
      this.BaselineResultList = arr
    },
    findBaselineLabel(BlID) {
      const baselineItem = this.BaselineResultList.find(item => item.id == BlID);
      return baselineItem ? baselineItem.Subject : '';
    },
    findBaselineFixScheme(BlID) {
      const baselineItem = this.BaselineResultList.find(item => item.id == BlID);
      return baselineItem ? baselineItem.FixScheme : '';
    },
    async changeMailGlobalAll(row) {
      const arr = this.eventTable.map(item => item.AutoID);
      const data = {
        Data: arr
      }
      const res = await connrequest('ConfirmEvent', data)
      if (res.Status.StatusCode === 0) {
        this.$message.success('确认成功')
        this.getEvent(this.Moder)
      }
    },
    async changeMailGlobal(row) {
      const data = {
        Data: [row.AutoID]
      }
      const res = await connrequest('ConfirmEvent', data)
      if (res.Status.StatusCode === 0) {
        this.$message.success('确认成功')
        this.getEvent(this.Moder)
      }
    },
    async getuseSoft(row) {
      const data = {
        Paging: {
          QueryPageNo: this.useSoftpageNum,
          QueryPageLength: this.useSoftpageSize
        },
        Filter: {
          PrimArea: row.PrimArea,
          SecondArea: row.SecondArea,
          // SchoolName: row.SchoolName,
          DeviceUUID: row.DeviceUUID
        }
      }
      const res = await connrequest('GetWindowProc', data)
      res.Data = res.Data || []
      res.Data = res.Data.map(item => {
        item.RunningSeconds = formatDuration(item.RunningSeconds)
        return item
      })
      this.useSoftTable = res.Data
      this.useSoftTotal = res.Paging?.TotalCount || 0
    },
    async GetDictSoftwareTree() {
      const res = await connrequest('GetDictInstallAppTree')
      let arr = [{ label: '全部', value: '' }]
      res.Data.Class.map(item => {
        arr.push({ label: item.Name, value: item.Name })
      })
      this.formOptions.map(item => {
        if (item.label === '软件分类') {
          item.options = arr
        }
      })
      this.partitionList_soft = arr.filter(item => item.label !== '全部')
    },
    async GetDictUseSoftTree() {
      const res = await connrequest('GetDictProcTree')
      let arr = []
      res.Data.Class.map(item => {
        arr.push({ label: item.Name, value: item.Name })
      })
      this.partitionList_use = arr
    },
    changeModer_use(row) {
      this.ModerDict = { ProcExe: row.ProcExe, ProcName: row.ProcName, ProcClass: row.ProcClass }
      this.UsemoderVisible = true
    },
    changeModer_int(row) {
      this.ModerDict = { ...row, Property: row.Property || 3, Class: this.partitionList_soft[0]?.value || '' }
      this.moderVisible = true;
    },
    async changeModer(row) {
      const data = {
        Filter: {
          StartTime: parseTime(new Date().getTime() - this.SystemData.cach_log_save_seconds * 60 * 60 * 1000),
          EndTime: parseTime(new Date().getTime()),
          DeviceUUID: row.DeviceUUID,
          PerfType: 1
        }
      }
      const res = await connrequest('GetDeviceHistoryPerfStatus', data)
      let downByte = []
      let time = []
      res.Data.map(item => {
        downByte.push(item.Percent)
        time.push(parseTime(item.TransTime, '{h}:{i}:{s}'))
      })
      var info = '近' + this.SystemData.cach_log_save_seconds + '小时CPU使用率'
      this.lineData_cpu = { time, downByte, info: info }
    },
    async changeModer_soft(row) {
      const data = {
        Filter: {
          StartTime: parseTime(new Date().getTime() - this.SystemData.cach_log_save_seconds * 60 * 60 * 1000),
          EndTime: parseTime(new Date().getTime()),
          DeviceUUID: row.DeviceUUID,
          PerfType: 2
        }
      }
      const res = await connrequest('GetDeviceHistoryPerfStatus', data)
      let downByte = []
      let time = []
      res.Data.map(item => {
        downByte.push(item.Percent)
        time.push(parseTime(item.TransTime, '{h}:{i}:{s}'))
      })
      var info = '近' + this.SystemData.cach_log_save_seconds + '小时内存使用率'
      this.lineData_soft = { time, downByte, info: info }
    },
    async getEvent(row) {
      const data = {
        Paging: {
          QueryPageNo: this.EventpageNum,
          QueryPageLength: this.EventpageSize
        },
        Filter: {
          "StartTime": getNowDay('time'),
          "EndTime": getNowDay('23:59:59'),
          "PrimArea": row.PrimArea,
          "SecondArea": row.SecondArea,
          "SchoolName": row.SchoolName,
          "DeviceUUID": row.DeviceUUID
        }
      }
      const res = await connrequest('GetEventLog', data)
      res.Data = res.Data || []
      this.control = false
      res.Data = res.Data.map(item => {
        item.TransTime = parseTime(item.TransTime)
        if (item.IsACK === 0) {
          this.control = true
        }
        return item
      })
      this.eventTable = res.Data
      this.EventTotal = res.Paging.TotalCount
    },
    handleSizeChangeNet(pageSize) {
      this.pageSize_net = pageSize
      this.pageNum_net = 1
      this.getNetData(this.Moder)
    },
    handleCurrentChangeNet(pageNum) {
      this.pageNum_net = pageNum
      this.getNetData(this.Moder)
    },
    handleSizeChange2(pageSize) {
      this.pageSize2 = pageSize
      this.pageNum2 = 1
      this.changeMailGlobalnet(this.netInfo)
    },
    handleCurrentChange2(pageNum) {
      this.pageNum2 = pageNum
      this.changeMailGlobalnet(this.netInfo)
    },
    handleSizeChangeuse(pageSize) {
      this.useSoftpageSize = pageSize
      this.useSoftpageNum = 1
      this.getuseSoft(this.Moder)
    },
    handleCurrentChangeuse(pageNum) {
      this.useSoftpageNum = pageNum
      this.getuseSoft(this.Moder)
    },
    handleSizeChange_int(pageSize) {
      this.pageSize_int = pageSize
      this.pageNum_int = 1
      this.getinstallData(this.Moder)
    },
    handleCurrentChange_int(pageNum) {
      this.pageNum_int = pageNum
      this.getinstallData(this.Moder)
    },
    handleSizeChange_ill(pageSize) {
      this.pageSize_ill = pageSize
      this.pageNum_ill = 1
      this.getillegalityData(this.Moder)
    },
    handleCurrentChange_ill(pageNum) {
      this.pageNum_ill = pageNum
      this.getillegalityData(this.Moder)
    },
    handleSizeChange_def(pageSize) {
      this.pageSize_def = pageSize
      this.pageNum_def = 1
      this.getdeficiencyData(this.Moder)
    },
    handleCurrentChange_def(pageNum) {
      this.pageNum_def = pageNum
      this.getdeficiencyData(this.Moder)
    },
    handleSizeChange_dev(pageSize) {
      this.pageSize_dev = pageSize
      this.pageNum_dev = 1
      this.getDeviceStatus(this.Moder)
    },
    handleCurrentChange_dev(pageNum) {
      this.pageNum_dev = pageNum
      this.getDeviceStatus(this.Moder)
    },
    handleSizeChange_event(pageSize) {
      this.pageSize_event = pageSize
      this.pageNum_event = 1
      this.getBaseLineData(this.Moder)
    },
    handleCurrentChange_event(pageNum) {
      this.pageNum_event = pageNum
      this.getBaseLineData(this.Moder)
    },
    handleSizeChangeEvent(pageSize) {
      this.EventpageSize = pageSize
      this.EventpageNum = 1
      this.getEvent(this.Moder)
    },
    handleCurrentChangeEvent(pageNum) {
      this.EventpageNum = pageNum
      this.getEvent(this.Moder)
    },
    async getDeviceData(row) {
      const data = {
        Paging: {
          "QueryPageNo": 1,
          "QueryPageLength": 10
        },
        Filter: {
          "PrimArea": row.PrimArea,
          "SecondArea": row.SecondArea,
          "SchoolName": row.SchoolName,
          // "DeviceName": row.DeviceName,
          "DeviceUUID": row.DeviceUUID
        }
      }
      const res = await connrequest('GetDeviceHardware', data)
      this.deviceForm = res.Data[0] || {}
      this.deviceForm.ExtDiskSize = parseInt(this.deviceForm.ExtDiskSize / 1000) + 'G'
      this.deviceForm.MemSize = bytesToSize(this.deviceForm.MemSize)
      if (this.deviceForm.TransTime != undefined)
        this.deviceForm.TransTime = formatTime2(this.deviceForm.TransTime)
      this.deviceForm.SysDiskSize = parseInt(this.deviceForm.SysDiskSize / 1000) + 'G'
    },
    async getinstallData(row) {
      // const res2 = await connrequest('GetDeviceRelationVerion')
      const data = {
        Paging: {
          "QueryPageNo": this.pageNum_int,
          "QueryPageLength": this.pageSize_int
        },
        Filter: {
          "PrimArea": row.PrimArea,
          "SecondArea": row.SecondArea,
          "SchoolName": row.SchoolName,
          "DeviceUUID": row.DeviceUUID,
          "InstallAppType": 1
        }
      }
      const res = await connrequest('GetInstallApp', data)
      const currentTimeStamp = new Date().getTime();
      res.Data = res.Data.map(item => {
        // 安装软件采集时间
        item.TransTime = formatTime2(item.TransTime)
        return item
      })
      this.installTable = res.Data
      this.Total_int = res.Paging.TotalCount
    },
    async getillegalityData(row) {
      const data = {
        Paging: {
          "QueryPageNo": this.pageNum_ill,
          "QueryPageLength": this.pageSize_ill
        },
        Filter: {
          "PrimArea": row.PrimArea,
          "SecondArea": row.SecondArea,
          "SchoolName": row.SchoolName,
          "DeviceUUID": row.DeviceUUID,
          "InstallAppType": 2
        }
      }
      const res = await connrequest('GetInstallApp', data)
      const currentTimeStamp = new Date().getTime();
      res.Data = res.Data.map(item => {
        // 非法软件采集时间
        item.TransTime = formatTime2(item.TransTime)
        return item
      })
      this.illegalityTable = res.Data
      this.Total_ill = res.Paging.TotalCount
    },
    async getdeficiencyData(row) {
      const data = {
        Paging: {
          "QueryPageNo": this.pageNum_def,
          "QueryPageLength": this.pageSize_def
        },
        Filter: {
          "PrimArea": row.PrimArea,
          "SecondArea": row.SecondArea,
          "SchoolName": row.SchoolName,
          "DeviceUUID": row.DeviceUUID,
          "InstallAppType": 3
        }
      }
      //  return
      const res = await connrequest('GetInstallApp', data)
      const currentTimeStamp = new Date().getTime();
      res.Data = res.Data.map(item => {
        // 必装软件采集时间
        item.TransTime = formatTime2(item.TransTime)
        return item
      })

      this.deficiencyTable = res.Data
      this.Total_def = res.Paging.TotalCount
    },
    async getNetData(row) {
      const data = {
        Paging: {
          "QueryPageNo": this.pageNum_net,
          "QueryPageLength": this.pageSize_net
        },
        Filter: {
          DeviceUUID: row.DeviceUUID
        }
      }
      const res = await connrequest('GetDeviceRealNetworkService', data)
      const currentTimeStamp = new Date().getTime();
      res.Data = res.Data.map(item => {
        // 网络业务检测时间
        item.TransTime = formatTime2(item.TransTime)
        return item
      })
      this.netForm = res.Data
      this.total_net = res.Paging.TotalCount

    },
    async getDeviceStatus(row) {
      const data = {
        Paging: {
          "QueryPageNo": this.pageNum_dev,
          "QueryPageLength": this.pageSize_dev
        },
        Filter: {
          PrimArea: row.PrimArea,
          SecondArea: row.SecondArea,
          SchoolName: row.SchoolName,
          DeviceUUID: row.DeviceUUID
        }
      }
      const res = await connrequest('GetDeviceStatusChangeLog', data)
      res.Data = res.Data.map(item => {
        // 状态变更发生时间
        item.TransTime = formatTime2(item.TransTime)
        return item
      })
      this.devieceStaTable = res.Data
      this.Total_dev = res.Paging.TotalCount
    },
    async getBaseLineData(row) {
      this.GetBaselineFixSet()
      const data = {
        Paging: {
          QueryPageNo: this.pageNum_event,
          QueryPageLength: this.pageSize_event
        },
        Filter: {
          PrimArea: row.PrimArea || '',
          SecondArea: row.SecondArea || '',
          SchoolName: row.SchoolName || '',
          DeviceUUID: row.DeviceUUID || '',
          // BlID: row.BlID * 1,
          BaselineNeedFix: 0,
        }
      }
      const res = await connrequest('GetDeviceRealBaselineCheck', data)
      res.Data = res.Data || []
      const currentTimeStamp = new Date().getTime();
      res.Data = res.Data.map(item => {
        // 基线核查检测时间
        item.TransTime = formatTime2(item.TransTime)
        return item
      })
      this.BaseLineForm = res.Data
      this.Total_event = res.Paging?.TotalCount
    },
    async exportFollow() {
      // const data = {
      //   Data: {}
      // }
      // const res = await connrequest('ExportDevice', data)
      // let softwareName = res.Data.FileName
      // const a = document.createElement('a');
      // a.style.display = 'none';
      // // a.target = '_blank';
      // a.href = softwareName;
      // // a.download = softwareName;
      // a.click();
      // a.remove();
      let arr = []
      let data = this.BaseLineForm
      data.map(item => {
        arr.push({
          Department: item.Department,
          DeviceName: item.DeviceName,
          TransTime: item.TransTime,
          BlID: this.findBaselineLabel(item.BlID),
          NeedFix: item.NeedFix === 0 ? '合规' : '不合规',
          Descp: item.Descp,
        })
      })
      /// 将对象数组转换为包含数据的二维数组
      const dataArray = arr.map(obj => Object.values(obj));
      dataArray.unshift(['部门', '资产名称', '检测时间', '检测项目', '合规结论', '描述信息']);
      // 创建一个 Workbook 对象
      const wb = XLSX.utils.book_new();
      const ws = XLSX.utils.aoa_to_sheet(dataArray);
      // 设置表头宽度，以及其他单元格样式
      const wscols = [
        { wch: 20 }, 
        { wch: 20 }, 
        { wch: 20 }, 
        { wch: 50 }, 
        { wch: 20 }, 
        { wch: 50 }, 
      ];
      ws['!cols'] = wscols;
      // 将工作表添加到工作簿中
      XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
      // 将工作簿导出为数据流
      const wopts = { bookType: 'xlsx', bookSST: false, type: 'array' };
      const wbout = XLSX.write(wb, wopts);
      // 将数据流转换为 Blob
      const blob = new Blob([wbout], { type: 'application/octet-stream' });
      // 创建一个下载链接
      const url = URL.createObjectURL(blob);
      const a = document.createElement('a');
      a.href = url;
      a.download = '基线核查导出表.xlsx';
      // 触发链接的点击事件来开始下载
      a.click();
      // 释放资源
      URL.revokeObjectURL(url);
    },
  }

}
</script>

<style>
.el-descriptions-item__label.is-bordered-label {
  width: 200px;
}
</style>